<!doctype html>
<title>WebSockets: close() several times</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.js?pipe=sub></script>
<div id=log></div>
<script>
var i = 0;
async_test(function(t) {
  var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
  ws.onclose = function(e) {
    i++;
  }
  ws.close();
  ws.close();
  ws.close();
  setTimeout(t.step_func(function() {
    assert_equals(i, 1);
    t.done()
  }), 50);
});
</script>
